function animacionArquero() {
	this.contexto = document.getElementById("canvasMov").getContext("2d");
	this.grados = 315;
	this.incremento = 1;
	this.imagen = new Image();
	this.is_ready = false;
	var that = this;
	this.imagen.onload = function(){ 
		that.is_ready = true;
	}
	this.imagen.src = "imagenes/arquero.png";
			
	this.progresa = function() {
		if (this.is_ready) {
			this.grados = this.grados + this.incremento;
			if (this.grados >= 395)
				this.incremento = -1;
			else if (this.grados <= 315)
				this.incremento = 1;	
			this.contexto.clearRect(0,0,800,400);
			var radianes = this.grados * Math.PI / 180;
			this.contexto.save();
			this.contexto.translate(118,165);
			this.contexto.rotate(radianes);
			// this.contexto.drawImage(this.imagen,47,0,35,11,132,169,35,11);
			this.contexto.drawImage(this.imagen,47,0,35,11,4,-6,35,11);
			this.contexto.setTransform(1,0,0,1,0,0);
			this.contexto.drawImage(this.imagen,0,0,39,120,100,100,39,120);
			this.contexto.translate(118,165);
			this.contexto.rotate(radianes);
			//this.contexto.drawImage(this.imagen,43,21,92,96,80,136,92,96);
			this.contexto.drawImage(this.imagen,43,21,92,96,-26,-50,92,96);
			this.contexto.restore();
			setTimeout(function(){that.progresa()}, 100);		
		}
		else
			setTimeout(function(){that.progresa()}, 100);		
	}	
	
}

window.onload = function() {
	var animacion = new animacionArquero();
	animacion.progresa();
}
